import request from '@/utils/request.js'

/**
 * 获取部门树
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function getDeptTree(searchParams) {
  return request.get('/dept/tree', {
    params: {
      status: searchParams?.status,
      deptName: searchParams?.deptName
    }
  })
}

/**
 * 删除部门信息
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function deleteDept(id) {
  return request.delete(`/dept/remove/${id}`)
}

/**
 * 添加部门
 * @param addForm
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function addOrEditDept(addForm) {
  return request.post('/dept/add', addForm)
}
